<!--
 * @Author: deliteam 462085920@qq.com
 * @Date: 2023-12-01 14:35:09
 * @Description: https://cdpn.io/cpe/boomboom/index.html?key=index.html-bf8b3a8a-aaa1-3555-a759-846a29f12eb1
-->
<template>
    <div class="wrap">
        <span :class="linkCls" href="#">
            {{ btnText }}
        </span>
    </div>
</template>

<script setup>
const props = defineProps({
    bgColor: {
        type: String,
        default: "#000"
    },
    // 0-11
    theme: {
        type: Number,
        default: 11
    },
    btnText: {
        type: String,
        default: "Get in touch"
    }
});
let linkCls = computed(() => {
    return `btn-${props.theme}`
})
</script>

<style lang="scss" scoped>
.wrap {
    width: 250px;
    height: 60px;
    line-height: 60px;
    display: inline-block;
    font-family: "gilroy", Sans-Serif;
    font-size: 1.25rem;
    border: 1px solid currentColor;
}

@media screen and (max-width: 767px) {
    .wrap {
        font-size: 1.15rem;
        height: 48px;
        line-height: 48px;
    }
}

[class^=btn-] {
    color: #000;
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    text-align: center;
    cursor: pointer;

    &:hover {
        color: #fff;
        outline-width: 0;
        transition: 0.5s ease-in-out;
    }
}

.btn-0:before {
    z-index: -1;
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: v-bind(bgColor);
    transform: translateX(-100%);
    transition: 0.5s ease-in-out;
}


.btn-0:hover:before {
    transform: translateX(0);
}



.btn-11:before,
.btn-11:after {
    position: absolute;
    top: 50%;
    content: "";
    width: 20px;
    height: 20px;
    background-color: v-bind(bgColor);
    border-radius: 50%;
}

.btn-11:before {
    left: -20px;
    transform: translate(-50%, -50%);
    transition: 0.5s ease-in-out;
    z-index: -1;
}

.btn-11:hover:before {
    animation: criss-cross-left 0.8s both;
    animation-direction: alternate;
}

.btn-11:hover:after {
    animation: criss-cross-right 0.8s both;
    animation-direction: alternate;
}

.btn-11:after {
    right: -20px;
    transform: translate(50%, -50%);
    transition: 0.5s ease-in-out;
    z-index: -1;
}



@keyframes criss-cross-left {
    0% {
        left: -20px;
    }

    50% {
        left: 50%;
        width: 20px;
        height: 20px;
    }

    100% {
        left: 50%;
        width: 375px;
        height: 375px;
    }
}



@keyframes criss-cross-right {
    0% {
        right: -20px;
    }

    50% {
        right: 50%;
        width: 20px;
        height: 20px;
    }

    100% {
        right: 50%;
        width: 375px;
        height: 375px;
    }
}

@media screen and (max-width: 767px) {
    [class^=btn-] {
        pointer-events: none;
    }
}
</style>
